<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>百度地图学习</title>
    <!--添加这个移动端的自适应-->
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <!--添加百度地图的浏览器的密钥-->
    <script src="http://api.map.baidu.com/api?v=2.0&ak=5PCFGIUCYfSubcLaKDdioCY4WyztACEr"></script>
    <style>
        html {
            height:100%;
        }
        body {
            height:100%;
            margin:0;
            padding:0;
        }
        #container {
            height:100%;
        }
    </style>
</head>
<body>
<div id="container"></div>
<div id="results"></div>
<div id="log"></div>
<div id="panorama" style="width:100%;height:100%"></div>
</body>
</html>
<script  type="text/javascript">
//    var map = new BMap.Map("container");         // 创建地图实例
//    var point = new BMap.Point(113.727822, 34.732691);  // 创建点坐标
//    map.centerAndZoom(point, 15);                 // 初始化地图，设置中心点坐标和地图级别
//    var traffic = new BMap.TrafficLayer();        // 创建交通流量图层实例
//    map.addTileLayer(traffic);                    // 将图层添加到地图上
//    若要从地图上移除图层，需要调用map.removeTileLayer方法。
//    map.removeTileLayer(traffic);                // 将图层移除


//添加标注工具
//var map = new BMap.Map("container");
//map.centerAndZoom(new BMap.Point(116.404, 39.915), 15);
//var myPushpin = new BMap.PushpinTool(map);         // 创建标注工具实例
//myPushpin.addEventListener("markend", function(e){  // 监听事件，提示标注点坐标信息
//    alert("您标注的位置：" +
//            e.marker.getPoint().lng + ", " +
//            e.marker.getPoint().lat);
//});
//myPushpin.open();                                  // 开启标注工具

//搜索服务
//var map = new BMap.Map("container");
//map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
//var local = new BMap.LocalSearch(map, {
//    renderOptions:{map: map}
//});
//local.search("天安门");

//var map = new BMap.Map("container");
//map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
//var local = new BMap.LocalSearch(map,
//        {renderOptions: {map: map,panel: "results"}});
//local.search("中关村");

//var map = new BMap.Map("container");
//map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
//var options = {
//    onSearchComplete: function(results){
//        if (local.getStatus() == BMAP_STATUS_SUCCESS){
//            // 判断状态是否正确
//            var s = [];
//            for (var i = 0; i < results.getCurrentNumPois(); i ++){
//                s.push(results.getPoi(i).title + ", " + results.getPoi(i).address);
//            }
//            document.getElementById("log").innerHTML = s.join("<br>");
//        }
//    }
//};
//var local = new BMap.LocalSearch(map, options);
//local.search("公园");
//var map = new BMap.Map("container");
//map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
//var local = new BMap.LocalSearch(map,
//        { renderOptions:{map: map, autoViewport: true}});
//local.searchNearby("小吃", "前门");

//var map = new BMap.Map("container");
//map.centerAndZoom(new BMap.Point(113.727822, 34.732691), 14);
//var local = new BMap.LocalSearch(map,
//        { renderOptions:{map: map}});
//local.searchInBounds("郑州轻工业学院", "轻院");

//var map = new BMap.Map("container");
//map.centerAndZoom(new BMap.Point(113.727822, 34.732691), 14);
//var transit = new BMap.TransitRoute(map, {
//    renderOptions: {map: map, panel: "results"}
//});
//transit.search("郑州轻工业学院", "郑州火车站 ");

//    驾车导航
//var map = new BMap.Map("container");
//map.centerAndZoom(new BMap.Point(113.727822, 34.732691), 14);
//var driving = new BMap.DrivingRoute(map, {
//    renderOptions: {
//        map: map,
//        autoViewport: true
//    }
//});
//driving.search("郑州", "正阳县");
//
//var map = new BMap.Map("container");
//map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
//// 创建地址解析器实例
//var myGeo = new BMap.Geocoder();
//// 将地址解析结果显示在地图上，并调整地图视野
//myGeo.getPoint("北京市海淀区上地10街10号", function(point){
//    if (point) {
//        map.centerAndZoom(point, 16);
//        map.addOverlay(new BMap.Marker(point));
//    }
//}, "北京市");



var stCtrl = new BMap.PanoramaControl();
stCtrl.setOffset(new BMap.Size(20, 20));
map.addControl(stCtrl);


</script>